package com.tianze.tzkf.function.home;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.tianze.tzkf.R;
import com.tianze.tzkf.base.BaseActivity;
import com.tianze.tzkf.bean.BannerListBean;
import com.tianze.tzkf.view.CircleImageView;
import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Zcyang on 2018/12/27.
 */
public class HomeActivity extends BaseActivity {
    @BindView(R.id.tv_back)
    TextView tvBack;
    @BindView(R.id.tv_user_name)
    TextView tvUserName;
    @BindView(R.id.iv_user_icon)
    CircleImageView ivUserIcon;

    @Override
    protected void initData() {

    }

    @Override
    protected void initTitle() {
        Bundle extras = getIntent().getExtras();
        Bundle data = extras.getBundle("data");
        BannerListBean.DataBean bannerListBean = (BannerListBean.DataBean) data.getSerializable("bannerListBean");
        tvUserName.setText(readUser());
//        Glide.with(this).load(bannerListBean.getIcon()).into(ivUserIcon);

    }

    @Override
    protected void reflshData() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_home;
    }

    @Override
    protected void isNetConnect(boolean isNetChanges) {

    }


    @OnClick({R.id.tv_back, R.id.tv_user_name, R.id.iv_user_icon})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_back:
//                finish();
                removeCurrentActivity();
                break;
            case R.id.tv_user_name:
                break;
            case R.id.iv_user_icon: // 头像
                HomeExitDialog homeExitDialog = HomeExitDialog.newInstance(this);
                homeExitDialog.show(this.getSupportFragmentManager(), "homeExitDialog");
                break;
        }
    }


    public void exit(){
        Intent startMain = new Intent(Intent.ACTION_MAIN);
        startMain.addCategory(Intent.CATEGORY_HOME);
        startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(startMain);
        System.exit(0);
    }

}
